﻿using System;
using System.Collections.Generic;
using Colorful.Furniture.CommonDto;
using Colorful.Furniture.Extensions;

namespace Colorful.Furniture.PermissionManagement
{
    /// <summary>
    ///  日志分页列表请求体
    /// </summary>
    public class LogPageInputDto : PageInputDto
    {
        /// <summary>
        ///  授权方式
        /// </summary>
        public int? AuthorizationType { get; set; }

        /// <summary>
        ///  ip地址
        /// </summary>
        public string Ip { get; set; }

        /// <summary>
        ///  关键词
        /// </summary>
        public string Keywords { get; set; }

        /// <summary>
        ///  操作结果
        /// </summary>
        public int? OperationResult { get; set; }

        ///// <summary>
        /////  操作时间
        ///// </summary>
        //public string OperationDate { get; set; }

        /// <summary>
        ///  操作时间
        /// </summary>
        public List<string> OperationDate { get; set; }

        /// <summary>
        ///  浏览器类型
        /// </summary>
        public string Browser { get; set; }

        /// <summary>
        ///  方法描述
        /// </summary>
        public string ActionDescription { get; set; }

    }

    /// <summary>
    ///  日志分页
    /// </summary>
    public class LogPageOutputDto
    {
        /// <summary>
        ///  Id
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        ///  请求方式
        /// </summary>
        public string RequestMethod { get; set; }

        /// <summary>
        ///  方法描述
        /// </summary>
        public string ActionDescription { get; set; }

        /// <summary>
        ///  是否成功
        /// </summary>
        public bool Success { get; set; }

        /// <summary>
        ///  操作结果标记
        /// </summary>
        public string OperationResultTag => Success ? "成功" : "失败";

        /// <summary>
        ///   操作结果类型
        /// </summary>
        public string OperationResultType => Success ? "success" : "danger";

        /// <summary>
        ///  耗时
        /// </summary>
        public long ElapsedMilliseconds { get; set; }

        /// <summary>
        ///  备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        ///  浏览器
        /// </summary>
        public string Browser { get; set; }

        /// <summary>
        ///  操作系统
        /// </summary>
        public string OperationSystem { get; set; }

        /// <summary>
        ///  错误消息
        /// </summary>
        public string ErrorMessage { get; set; }

        /// <summary>
        ///  ip地址
        /// </summary>
        public string Ip { get; set; }

        /// <summary>
        ///  操作者
        /// </summary>
        public string Operator { get; set; }

        /// <summary>
        ///  操作者姓名
        /// </summary>
        public string OperatorName { get; set; }

        /// <summary>
        ///  添加时间
        /// </summary>
        public DateTime AddTime { get; set; }

        /// <summary>
        ///  添加时间
        /// </summary>
        public string AddTimeFormat => AddTime.ToDateString();
    }

    /// <summary>
    ///  日志信息详情
    /// </summary>
    public class LogInfoOutputDto
    {
        /// <summary>
        ///  Id
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        ///  请求URL地址
        /// </summary>
        public string RequestUrl { get; set; }

        /// <summary>
        ///  请求方式
        /// </summary>
        public string RequestMethod { get; set; }

        /// <summary>
        ///  方法描述
        /// </summary>
        public string ActionDescription { get; set; }

        /// <summary>
        ///  区域
        /// </summary>
        public string Area { get; set; }

        /// <summary>
        ///  控制器
        /// </summary>
        public string Controller { get; set; }

        /// <summary>
        ///  方法
        /// </summary>
        public string Action { get; set; }

        /// <summary>
        ///  请求体JSON
        /// </summary>
        public string RequestInput { get; set; }

        /// <summary>
        ///  是否成功
        /// </summary>
        public bool Success { get; set; }

        /// <summary>
        ///  操作结果标记
        /// </summary>
        public string OperationResultTag => Success ? "成功" : "失败";

        /// <summary>
        ///   操作结果类型
        /// </summary>
        public string OperationResultType => Success ? "success" : "danger";

        /// <summary>
        ///  失败消息，当Success = false有效
        /// </summary>
        public string ErrorMessage { get; set; }

        /// <summary>
        ///  耗时
        /// </summary>
        public long ElapsedMilliseconds { get; set; }

        /// <summary>
        ///  备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        ///  浏览器
        /// </summary>
        public string Browser { get; set; }

        /// <summary>
        ///  操作系统
        /// </summary>
        public string OperationSystem { get; set; }

        /// <summary>
        ///  ip地址
        /// </summary>
        public string Ip { get; set; }

        /// <summary>
        ///  操作人员帐号
        /// </summary>
        public string Operator { get; set; }

        /// <summary>
        ///  操作人员姓名
        /// </summary>
        public string OperatorName { get; set; }

        /// <summary>
        ///  操作者编码
        /// </summary>
        public Guid? OperatorId { get; set; }

        /// <summary>
        ///  操作者类型，1：后台管理员，2：用户
        /// </summary>
        public int OperatorType { get; set; }

        /// <summary>
        ///  添加时间
        /// </summary>
        public DateTime AddTime { get; set; }

        /// <summary>
        ///  添加时间
        /// </summary>
        public string AddTimeFormat => AddTime.ToDateString();
    }
}